<?php


namespace app\zhongcan\validate;




use think\Validate;

class NavValidate extends Validate
{
    //定义验证规则
    protected $rule = [
        'title' => 'require|max:30|min:1',
        'url' => 'require',
        'two_id' => 'require|integer',
        'id' => 'require'
    ];

    //定义验证失败时的提示信息
    protected $message = [
        'title.require' => '标题不能为空',
        'title.max:30' => '标题最大不能超过30个文字',
        'title.min:1' => '标题不能小于一个字',
        'url.require' => '图片不能为空',
        'two_id.require' => '浏览量不能为空',
        'two_id.integer' => '浏览量必须是整数',
        'id.require' => 'id不能为空',
        //......
    ];

    //验证场景
    protected $scene = [
        'add' => ['title','url'],
        'edit' => ['title','id'],
    ];

}